/*
 * Copyright (c) 2018.
 * 北京九思金信科技有限公司对该文件内容保留所有权利。
 * 未经许可，不得私自拷贝、传播、发布、引用该文件内容，违者将被追究法律责任。
 */

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import VueResource from 'vue-resource'
import Uuid from 'uuid'
import JoysUI from 'joys-ui'
import LssUI from 'lss-ui'
import global_ from './components/tool/Global'
import JoysBpmUI from 'joys-bpm-ui'

import('joys-ui/theme/' + localStorage.getItem('current-theme') + '/index.css')
Vue.prototype.GLOBAL = global_
Vue.config.productionTip = false
Vue.use(ElementUI)
Vue.use(VueResource)
Vue.use(Uuid)
Vue.use(JoysUI)
Vue.use(LssUI)
Vue.use(JoysBpmUI)

Vue.http.interceptors.push((request, next) => {
  console.log(request.url)
  var reg = /(https:\/\/data.riskstorm.com\/):*/

  console.log(!reg.test(request.url))
  if (!reg.test(request.url)) {
    request.headers.set('AUTH-TOKEN', localStorage.getItem('AUTH-TOKEN'))
    next(response => {
      return response
    })
  }
})
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: {App},
  template: '<App/>'
})
